﻿using ETC.DLEDLightingSystemPlus.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace ETC.DLEDLightingSystemPlus.Models
{
    public class TestItem : Bandit.UI.MVVM.NotifyObject
    {
        private int _Num;

        public int Num
        {
            get { return _Num; }
            set
            {
                _Num = value;
                OnPropertyChanged(nameof(Num));
            }
        }

        private string _TestItemCode;
        /// <summary>
        /// 代号
        /// </summary>
        public string TestItemCode
        {
            get { return _TestItemCode; }
            set
            {
                _TestItemCode = value;
                OnPropertyChanged("TestItemCode");
            }
        }

        private string _Name;
        /// <summary>
        /// 名称
        /// </summary>
        public string Name
        {
            get { return _Name; }
            set
            {
                _Name = value;
                OnPropertyChanged("Name");
            }
        }

        private bool _IsTestVisibility = true;
        /// <summary>
        /// 是否测试
        /// </summary>
        public bool IsTestVisibility
        {
            get { return _IsTestVisibility; }
            set
            {
                _IsTestVisibility = value;
                OnPropertyChanged("IsTestVisibility");
            }
        }

        private bool _IsTest = true;
        /// <summary>
        /// 是否测试
        /// </summary>
        public bool IsTest
        {
            get { return _IsTest; }
            set
            {
                _IsTest = value;
                OnPropertyChanged("IsTest");
            }
        }

        private bool _IsLimit = false;
        /// <summary>
        /// 是否Limit
        /// </summary>
        public bool IsLimit
        {
            get { return _IsLimit; }
            set
            {
                _IsLimit = value;
                OnPropertyChanged("IsLimit");
            }
        }

        private Limit _Limit;
        /// <summary>
        /// 上限下限
        /// </summary>
        public Limit Limit
        {
            get { return _Limit; }
            set
            {
                _Limit = value;
                OnPropertyChanged("Limit");
            }
        }

        private bool _IsReaValue = true;
        /// <summary>
        /// 是否设置值
        /// </summary>
        public bool IsReaValue
        {
            get { return _IsReaValue; }
            set
            {
                _IsReaValue = value;
                OnPropertyChanged("IsReaValue");
            }
        }

        private bool _IsSetCurrentValue = false;
        /// <summary>
        /// 是否设置电流值
        /// </summary>
        public bool IsSetCurrentValue
        {
            get { return _IsSetCurrentValue; }
            set
            {
                _IsSetCurrentValue = value;
                OnPropertyChanged("IsSetCurrentValue");
            }
        }

        private double _SetCurrentValue;
        /// <summary>
        /// 设置电流值
        /// </summary>
        public double SetCurrentValue
        {
            get { return _SetCurrentValue; }
            set
            {
                _SetCurrentValue = value;
                
                OnPropertyChanged("SetCurrentValue");
            }
        }

        private bool _IsSetMcValue;

        public bool IsSetMcValue
        {
            get { return _IsSetMcValue; }
            set
            {
                _IsSetMcValue = value;
                OnPropertyChanged("IsSetMcValue");
            }
        }

        private int _SetMcValue;

        public int SetMcValue
        {
            get { return _SetMcValue; }
            set
            {
                _SetMcValue = value;
                OnPropertyChanged(nameof(SetMcValue));
            }
        }

        private bool _IsSetDcValue;

        public bool IsSetDcValue
        {
            get { return _IsSetDcValue; }
            set
            {
                _IsSetDcValue = value;
                OnPropertyChanged("IsSetDcValue");
            }
        }

        private int _SetDcValue;

        public int SetDcValue
        {
            get { return _SetDcValue; }
            set
            {
                _SetDcValue = value;
                OnPropertyChanged(nameof(SetDcValue));
            }
        }

        private bool _IsSetBcValue;

        public bool IsSetBcValue
        {
            get { return _IsSetBcValue; }
            set
            {
                _IsSetBcValue = value;
                OnPropertyChanged("IsSetBcValue");
            }
        }

        private int _SetBcValue;

        public int SetBcValue
        {
            get { return _SetBcValue; }
            set
            {
                _SetBcValue = value;
                OnPropertyChanged(nameof(SetBcValue));
            }
        }

        private bool _IsSetScaleValue;

        public bool IsSetScaleValue
        {
            get { return _IsSetScaleValue; }
            set
            {
                _IsSetScaleValue = value;
                OnPropertyChanged("IsSetScaleValue");
            }
        }

        private int _SetScaleValue;

        public int SetScaleValue
        {
            get { return _SetScaleValue; }
            set
            {
                _SetScaleValue = value;
                OnPropertyChanged(nameof(SetScaleValue));
            }
        }

        private bool _IsSetILedValue;

        public bool IsSetILedValue
        {
            get { return _IsSetILedValue; }
            set
            {
                _IsSetILedValue = value;
                OnPropertyChanged("IsSetILedValue");
            }
        }

        private int _SetILedValue;

        public int SetILedValue
        {
            get { return _SetILedValue; }
            set
            {
                _SetILedValue = value;
                OnPropertyChanged(nameof(SetILedValue));
            }
        }

        private string _RealityCurrentValue;
        /// <summary>
        /// 实际电流值
        /// </summary>
        public string RealityCurrentValue
        {
            get { return _RealityCurrentValue; }
            set
            {
                _RealityCurrentValue = value;
                OnPropertyChanged("RealityCurrentValue");
            }
        }

        private string _RealityTotalCurrentValue;
        /// <summary>
        /// 实际电流值
        /// </summary>
        public string RealityTotalCurrentValue
        {
            get { return _RealityTotalCurrentValue; }
            set
            {
                _RealityTotalCurrentValue = value;
                OnPropertyChanged("RealityTotalCurrentValue");
            }
        }

        private string _IsRealityCurrentValueLimit;

        public string IsRealityCurrentValueLimit
        {
            get { return _IsRealityCurrentValueLimit; }
            set
            {
                _IsRealityCurrentValueLimit = value;
                OnPropertyChanged(nameof(IsRealityCurrentValueLimit));
            }
        }

        private string _Unit;

        public string Unit
        {
            get { return _Unit; }
            set
            {
                _Unit = value;
                OnPropertyChanged(nameof(Unit));
            }
        }

        private bool _IsSetCompensationValue = false;
        /// <summary>
        /// 是否设置补偿
        /// </summary>
        public bool IsSetCompensationValue
        {
            get { return _IsSetCompensationValue; }
            set
            {
                _IsSetCompensationValue = value;
                OnPropertyChanged("IsSetCompensationValue");
            }
        }

        private double _SetCompensationValue;
        /// <summary>
        /// 设置补偿值
        /// </summary>
        public double SetCompensationValue
        {
            get { return _SetCompensationValue; }
            set
            {
                _SetCompensationValue = value;
                OnPropertyChanged("SetCompensationValue");
            }
        }

        //private bool _IsSetShowBackgroundValue = false;
        ///// <summary>
        ///// 是否设置前景亮度
        ///// </summary>
        //public bool IsSetShowBackgroundValue
        //{
        //    get { return _IsSetShowBackgroundValue; }
        //    set
        //    {
        //        _IsSetShowBackgroundValue = value;
        //        OnPropertyChanged("IsSetShowBackgroundValue");
        //    }
        //}

        //private double _SetShowBackgroundValue;
        ///// <summary>
        ///// 设置前景亮度值
        ///// </summary>
        //public double SetShowBackgroundValue
        //{
        //    get { return _SetShowBackgroundValue; }
        //    set
        //    {
        //        _SetShowBackgroundValue = value;
        //        OnPropertyChanged("SetShowBackgroundValue");
        //    }
        //}

        private int _DelayTime = 1000;

        public int DelayTime
        {
            get { return _DelayTime; }
            set
            {
                _DelayTime = value;
                OnPropertyChanged(nameof(DelayTime));
            }
        }

        public TestItem() { }


        public TestItem(int num, string testItemCode, string name, bool isTestVisibility, bool isSetMC, int setMCValue, bool isSetDC, int setDCValue, bool isSetBC, int setBCValue,bool isSetScale,int setScaleValue,bool isSetIled,int setILEDValue, bool isSetCurrentValue, double setCurrentValue,  int delayTime, bool isLimit, Limit limit, string unit,bool isReaValue,bool isSetCompensationValue,double setCompensationValue)
        {
            this.Num = num;
            this.TestItemCode = testItemCode;
            this.Name = name;
            this.IsTestVisibility = isTestVisibility;
            this.DelayTime = delayTime;
            this.IsLimit = isLimit;
            this.Limit = limit;
            //this.IsSetValue = isSetValue;

            this.IsSetCurrentValue = isSetCurrentValue;
            this.SetCurrentValue = setCurrentValue;

            this.IsSetMcValue = isSetMC;
            this.SetMcValue = setMCValue;

            this.IsSetDcValue = isSetDC;
            this.SetDcValue = setDCValue;

            this.IsSetBcValue = isSetBC;
            this.SetBcValue = setBCValue;

            this.IsReaValue = isReaValue;

            this.IsSetScaleValue = isSetScale;
            this.SetScaleValue = setScaleValue;
            this.IsSetILedValue = isSetIled;
            this.SetILedValue = setILEDValue;

            this.Unit = unit;

            this.IsSetCompensationValue = isSetCompensationValue;
            this.SetCompensationValue = setCompensationValue;
        }
    }

    public class Limit : Bandit.UI.MVVM.NotifyObject
    {

        private double _Upper;
        /// <summary>
        /// 上限
        /// </summary>
        public double Upper
        {
            get { return _Upper; }
            set
            {
                _Upper = value;

                OnPropertyChanged("Upper");
            }
        }

        private double _Lower;
        /// <summary>
        /// 下限
        /// </summary>
        public double Lower
        {
            get { return _Lower; }
            set
            {
                _Lower = value;

                OnPropertyChanged("Lower");
            }
        }



        public Limit() { }

        public Limit(double lower, double upper)
        {
            this.Lower = lower;
            this.Upper = upper;

        }

    }
}
